import { Byte } from '../../api/io/Byte';
import { HashMap } from '../../api/struct/HashMap';


export const enum E_CDEquipmentSuit {
	/**套装id*/
	id,
	/**名称*/
	name,
	/**套装数量*/
	maxNum,
	/**被动技能*/
	skill_1,
	/**被动技能*/
	skill_2,
	/**被动技能*/
	skill_3,
	/**装备id_1*/
	equipment_1,
	/**装备id_2*/
	equipment_2,
	/**装备id_3*/
	equipment_3,
	/**装备id_4*/
	equipment_4,
	/**装备id_5*/
	equipment_5,
	/**装备id_6*/
	equipment_6,

	/**枚举数量*/
	EnumCount
}



export class CDEquipmentSuit{
	/**套装id*/
	public id: number;
	/**名称*/
	public name: number;
	/**套装数量*/
	public maxNum: number;
	/**被动技能*/
	public skill_1: number;
	/**被动技能*/
	public skill_2: number;
	/**被动技能*/
	public skill_3: number;
	/**装备id_1*/
	public equipment_1: number;
	/**装备id_2*/
	public equipment_2: number;
	/**装备id_3*/
	public equipment_3: number;
	/**装备id_4*/
	public equipment_4: number;
	/**装备id_5*/
	public equipment_5: number;
	/**装备id_6*/
	public equipment_6: number;


	/**获取属性值*/
	public getAttr(idx: number): any {
		switch(idx) { 
			default: return;
			case E_CDEquipmentSuit.id: return this.id;
			case E_CDEquipmentSuit.name: return this.name;
			case E_CDEquipmentSuit.maxNum: return this.maxNum;
			case E_CDEquipmentSuit.skill_1: return this.skill_1;
			case E_CDEquipmentSuit.skill_2: return this.skill_2;
			case E_CDEquipmentSuit.skill_3: return this.skill_3;
			case E_CDEquipmentSuit.equipment_1: return this.equipment_1;
			case E_CDEquipmentSuit.equipment_2: return this.equipment_2;
			case E_CDEquipmentSuit.equipment_3: return this.equipment_3;
			case E_CDEquipmentSuit.equipment_4: return this.equipment_4;
			case E_CDEquipmentSuit.equipment_5: return this.equipment_5;
			case E_CDEquipmentSuit.equipment_6: return this.equipment_6;
		}
	}



	/**设置属性值*/
	public setAttr(idx: number, v: any): void {
		switch(idx) { 
			default: break;
			case E_CDEquipmentSuit.id: this.id = v; break;
			case E_CDEquipmentSuit.name: this.name = v; break;
			case E_CDEquipmentSuit.maxNum: this.maxNum = v; break;
			case E_CDEquipmentSuit.skill_1: this.skill_1 = v; break;
			case E_CDEquipmentSuit.skill_2: this.skill_2 = v; break;
			case E_CDEquipmentSuit.skill_3: this.skill_3 = v; break;
			case E_CDEquipmentSuit.equipment_1: this.equipment_1 = v; break;
			case E_CDEquipmentSuit.equipment_2: this.equipment_2 = v; break;
			case E_CDEquipmentSuit.equipment_3: this.equipment_3 = v; break;
			case E_CDEquipmentSuit.equipment_4: this.equipment_4 = v; break;
			case E_CDEquipmentSuit.equipment_5: this.equipment_5 = v; break;
			case E_CDEquipmentSuit.equipment_6: this.equipment_6 = v; break;
		}
	}


	/**数据*/
	public static datas: HashMap<number, CDEquipmentSuit> = new HashMap<number, CDEquipmentSuit>();



	/**加载数据*/
	public static load(byte: Byte): void{
		const size = byte.readInt32();
		const list : CDEquipmentSuit[] = [];
		let i :number;

		for (i = 0; i < size; i++) {
			list[i] = new CDEquipmentSuit();
		}
		for (i = 0; i < size; i++) {
			list[i].id = byte.readInt32();
			this.datas.put(list[i].id, list[i]);
		}
		for (i = 0; i < size; i++) {
			list[i].name = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].maxNum = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].skill_1 = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].skill_2 = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].skill_3 = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].equipment_1 = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].equipment_2 = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].equipment_3 = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].equipment_4 = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].equipment_5 = byte.readInt32();
		}
		for (i = 0; i < size; i++) {
			list[i].equipment_6 = byte.readInt32();
		}
	}


	/** 获取数据*/
	public static getData(id: number): CDEquipmentSuit{
		return this.datas ? this.datas.get(id) : null;
	}
}
